

class composite_handler(object):
    """
    The composite_handler is composed of multiple handlers, which
    can potentially manipulate the composite_handler to alter it's
    behavior at run-time.
    """
    def __init__(self):
        self.handlers = []

    def initialize(self):
        """
        This method actually initializes the handler
        """
        for handler in self.handlers:
            handler.initialize()

    def add_handler(self, handler):
        self.handlers.append(handler)

    def remove_handler(self, handler):
        self.handlers.remove(handler)

    def match (self, request):
        return 1

    def handle_request (self, request):
        for handler in self.handlers:
            if handler.match(request):
                handler.handle_request(request)

